package com.yunzhi.www.smarthome.fragmentpack;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.content.Intent;
import android.widget.Toast;

import com.squareup.leakcanary.RefWatcher;
import com.yunzhi.www.fromlibrary.base.BaseFragment;
import com.yunzhi.www.smarthome.BaseApplication;
import com.yunzhi.www.smarthome.R;

/**
 * Created by XYLi on 2017/3/20.
 */

public class MainPage extends BaseFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater,container,savedInstanceState);
        View view=inflater.inflate(R.layout.activity_main,container,false);
        return view;
    }

    @Override
    public void onViewCreated(View view,Bundle savedInstanceState) {
        super.onViewCreated(view,savedInstanceState);

    }

    @Override
    public void onFragmentResult(int requestCode,int resultCode,Intent data){
        super.onFragmentResult(requestCode,resultCode,data);
        if(data!=null) {
            Bundle extras = data.getExtras();
            Toast.makeText(getActivity(), "requestCode:" + requestCode + " result:" + resultCode+" data:"+extras.getString("data"), Toast.LENGTH_LONG).show();
        }
    }
    @Override
    public void onDestroy() {
        super.onDestroy();
        RefWatcher refWatcher = BaseApplication.getRefWatcher(getActivity());
        refWatcher.watch(this);
    }
}
